const UserModel = require("../../models/UseModel");

const userServices = {
  login: async (body) => {
    return UserModel.find(body);
  },

  getInfo: async (body) => {
    return UserModel.findOne(body);
  },

  addUser: async (params) => {
    return UserModel.create(params);
  },
  getUserList: async () => {
    return UserModel.find();
  },
  deleteUser: async (params) => {
    return UserModel.deleteOne(params);
  },
  editUser: async (params) => {
    console.log(params);
    return UserModel.findOneAndUpdate({ username: params.username }, params);
    // return UserModel.updateOne(pa)
  },
};

module.exports = userServices;
